use the shell in Linux to get yesterday, tomorrow or many days before the date time -- A- , the: -:xxblogjava-Expert Area Original http://www.blogjava.net/xzclog/archive/2015/12/08/428555.htmlTheme Shell Original address:
ArticleDirectory
UNIX Origin
UNIX splitting
UNIX legal disputes
UNIX open-source organization
Linux was born
Linux leader today
For more information, see http://coolshell.cn/articles/2322.html. In conclusion, we will know
Local Test Cases:
# there can be no spaces on either side of the equal sign, before the error has been out here
yesterday= ' date-d last-day +%y-%m-%d '
echo $yesterday
curday= ' Date +%y-%m-%d '
echo $curday
echo "Now time: ' Date ' +%y%m%d%T '"
Is UNIX used in daily office environments? Not necessarily very clumsy. Using the powerful functions and available system tools of Unix shell can greatly improve your work efficiency in the office.
Introduction
UNIX? The command line language is
Name: Date
Permission: All Users
Usage: Date [-u] [-D datestr] [-s datestr] [-- UTC] [-- Universal]
[-- Date = datestr] [-- set = datestr] [-- help] [-- version] [+ format]
[Mmddhhmm [[CC] YY] [. SS]
Note: date can be used to display or set the date
Name: DatePermission: All UsersUsage: date [-u] [-D datestr] [-s datestr] [-- UTC] [-- Universal] [-- date = datestr] [-- set = datestr] [-- help] [-- version] [+ format] [mmddhhmm [[CC] YY] [. SS]Note: date can be used to display or set the date
Get the date of the dayDate +%y-%m-%dOutput: 2011-07-28Assigns the current date to a date variabledate=$ (Date +%y%m%d)Sometimes we need to use dates before or after today, so we can use the-D parameter of dateGet Tomorrow's dateDate-d Next-day
This article introduces two tips: how mysql converts a timestamp to a common time format and how MySql queries the current database time.
(1) run the following command to query the current time of a database in MySql:
Select now (); // return format:
The most primitive method is to write a complicated function, know the number of days each month, and handle the leap year situation-this is a bit tedious.
Take a look at the date command and you will find that using it can easily write a very
Use the shell in Linux to get yesterday, tomorrow, or many days ago:In Linux, the man date-d parameter is relatively vague, the following examples further illustrate:#-D,--date=string display time described by STRING, not ' now '[Email protected]
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.